﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Globalization;


namespace devtm.Verbatim.CustomConverters
{


    /// <summary>
    /// Interface for the generic model converter
    /// </summary>
    /// <typeparam name="TSource"></typeparam>
    /// <typeparam name="TTarget"></typeparam>
    public interface IConverter
    {


        /// <summary>
        /// Method for convert
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        object Convert(object value);



        /// <summary>
        /// Method for convert
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        object ConvertBack(object value);



        bool CanConvert(object value);



        bool CanConvertBack(object value);

    }


    /// <summary>
    /// Interface for the generic model converter
    /// </summary>
    /// <typeparam name="TSource"></typeparam>
    /// <typeparam name="TTarget"></typeparam>
    /// <typeparam name="TParameter"></typeparam>
    public interface IConverter<TSource, TTarget, TParameter> : IConverter
        where TParameter : class
    {


        /// <summary>
        /// Method for convert
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        TTarget Convert(TSource value);


        /// <summary>
        /// Method for convert
        /// </summary>
        /// <param name="value"></param>
        /// <param name="parameter"></param>
        /// <returns></returns>
        TTarget Convert(TSource value, TParameter parameter);


        /// <summary>
        /// Method for convert
        /// </summary>
        /// <param name="value"></param>
        /// <param name="parameter"></param>
        /// <param name="culture"></param>
        /// <returns></returns>
        TTarget Convert(TSource value, TParameter parameter, CultureInfo culture);


        /// <summary>
        /// Method for convert Back
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        TSource Convert(TTarget value);


        /// <summary>
        /// Method for convert Back
        /// </summary>
        /// <param name="value"></param>
        /// <param name="parameter"></param>
        /// <returns></returns>
        TSource Convert(TTarget value, TParameter parameter);


        /// <summary>
        /// Method for convert Back
        /// </summary>
        /// <param name="value"></param>
        /// <param name="parameter"></param>
        /// <param name="culture"></param>
        /// <returns></returns>
        TSource Convert(TTarget value, TParameter parameter, CultureInfo culture);

    }


    /// <summary>
    /// Interface for the generic model converter
    /// </summary>
    /// <typeparam name="TSource"></typeparam>
    /// <typeparam name="TTarget"></typeparam>
    public interface IConverter<TSource, TTarget> : IConverter<TSource, TTarget, Object>
    {

    }


}
